<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>福利</title>
    <link rel="stylesheet" type="text/css" href="../css/api.css"/>
    <link rel="stylesheet" type="text/css" href="../css/aui.css"/>
    <link rel="stylesheet" type="text/css" href="../css/iconfont.css"/>
    <link rel="stylesheet" type="text/css" href="../css/auislide.css"/>
    <link rel="stylesheet" type="text/css" href="../css/style.css"/>
    <style>
        .empty {
            text-align: center;
            padding: 120px 0;
        }
        .aui-row img {
            width: 2.5rem;
            height: 2.5rem;
        }
    </style>
</head>
<body>
<div id="aui-slide" class="fx-box">
    <div id="slidebox" class="aui-slide-wrap"
         style="margin: 5px;border-radius:0.5rem;box-shadow:0.1rem 0.1rem 0.4rem rgba(99, 99, 99, 0.3);">

        <!--顶部横幅未加载完成时的提示-->
        <img id="bpic" src="../image/default_picture/default_banner.png" onclick="h5('https://www.mk33.cc')">
        <!--顶部横幅未加载完成时的提示-->


    </div>
    <div class="aui-slide-page-wrap"><!--分页容器--></div>
</div>

<div class="aui-card-box">
    <div style="border-radius: 15px; margin:10px 0px -6px; box-shadow: 0 0 10px rgba(0,0,0,0.3);">

        <span style="color:#444;font-size: 0.7rem; margin:5px;"><i class="iconfont icon-zuirehotchunse" style="color:#E91E63;font-size: 0.8rem"></i>福利推荐</span>


        <section class="aui-grid aui-margin-b-15" style="border-radius: 15px;">
            <div class="aui-row" style="border-radius: 15px;" id="fl_list">
                <!--VIP 观影区未加载完成时的提示-->
                <div class="aui-col-xs-3 pt-list" onClick="h5('http://m.kuaidi100.com/index.jsp')">
                    <i class="aui-iconfont"><img src="../image/kd.jpg"/></i>
                    <div class="aui-grid-label">快递服务</div>
                </div>

                <div class="aui-col-xs-3 pt-list" onClick="h5('http://m.kuaikanmanhua.com')">
                    <i class="aui-iconfont"><img src="../image/kk.jpg"/></i>
                    <div class="aui-grid-label">快看漫画</div>
                </div>

                <div class="aui-col-xs-3 pt-list" onClick="h5('http://m.maoyan.com')">
                    <i class="aui-iconfont"><img src="../image/my.jpg"/></i>
                    <div class="aui-grid-label">猫眼电影</div>
                </div>

                <div class="aui-col-xs-3 pt-list"
                     onClick="h5('https://m.toutiao.com/?w2atif=1&channel=news_hot#channel=news_hot')">
                    <i class="aui-iconfont"><img src="../image/tt.jpg"/></i>
                    <div class="aui-grid-label">今日头条</div>
                </div>

                <div class="aui-col-xs-3 pt-list" onClick="h5('http://m.lrts.me/')">
                    <i class="aui-iconfont"><img src="../image/lr.jpg"/></i>
                    <div class="aui-grid-label">懒人听书</div>
                </div>

                <div class="aui-col-xs-3 pt-list" onClick="h5('https://xw.qq.com/')">
                    <i class="aui-iconfont"><img src="../image/tx.jpg"/></i>
                    <div class="aui-grid-label">腾讯新闻</div>
                </div>

                <div class="aui-col-xs-3 pt-list" onClick="h5('https://m.qidian.com/')">
                    <i class="aui-iconfont"><img src="../image/xiaoshuo.jpg"/></i>
                    <div class="aui-grid-label">起点小说</div>
                </div>

                <div class="aui-col-xs-3 pt-list" onclick="h5('http://inews.ifeng.com/?ch=ifengweb_2014')">
                    <i class="aui-iconfont"><img src="../image/fh.png"/></i>
                    <div class="aui-grid-label">凤凰新闻</div>
                </div>
                <!--VIP 观影区未加载完成时的提示-->
            </div>
        </section>
    </div>
</div>





<!--
  <div class="fx-box" id="guanggao">

    <div class="fx-box-t">
      <img src="../image/default_picture/default_banner.png" style="margin: 10px;border-radius:0.5rem;box-shadow:0.1rem 0.1rem 0.4rem rgba(99, 99, 99, 0.3);"  tapmode onClick="UnloadedCompleted()">
    </div>
    <div class="br"></div>
    <div class="fx-box-t">
      <img src="../image/default_picture/default_banner.png" style="margin: 10px;border-radius:0.5rem;box-shadow:0.1rem 0.1rem 0.4rem rgba(99, 99, 99, 0.3);"  tapmode onClick="UnloadedCompleted()">
    </div>


  </div>
-->

<div class="fx-box" id="guanggao">

    <div class="aui-slide-wrap"
         style="margin: 10px;border-radius:0.5rem;box-shadow:0.1rem 0.1rem 0.4rem rgba(99, 99, 99, 0.3);">

        <!--顶部横幅未加载完成时的提示-->
        <img id="bpic" src="../image/default_picture/default_banner.png" onClick="UnloadedCompleted()">
        <!--顶部横幅未加载完成时的提示-->

    </div>


</div>


<div class="">

</div>
</body>
<script type="text/x-dot-template" id="bannertpl">
    {{~ it.data : value : index }}
    <div class="aui-slide-node bg-dark" tapmode onclick="toBanner('{{= value. linkurl }}')">
        <img src="http://124.222.162.204:1002/{{= value. picurl }}"/>
    </div>
    {{~}}
</script>
<script type="text/x-dot-template" id="flicotpl">
    {{~ it.data : value : index }}
    <div class="aui-col-xs-3 pt-list" tapmode onclick="toBanner('{{= value. linkurl }}')">
        <i class="aui-iconfont"><img src="http://124.222.162.204:1002/{{= value. picurl }}"/></i>
        <div class="aui-grid-label">{{= value. name }}</div>
    </div>

    {{~}}
</script>
<script type="text/x-dot-template" id="guanggaotpl">
    {{~ it.data : value : index }}


    <div class="aui-slide-wrap"
         style="margin: 10px;border-radius:0.5rem;box-shadow:0.1rem 0.1rem 0.4rem rgba(99, 99, 99, 0.3);">

        <img src="http://124.222.162.204:1002/{{= value. picurl }}" tapmode onclick="toBanner('{{= value. linkurl }}')">

    </div>

    {{~}}
</script>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/doT.js"></script>
<script type="text/javascript" src="../script/auipullrefresh.js"></script>
<script type="text/javascript" src="../script/auislide.js"></script>
<script type="text/javascript" src="../script/auilazyload.js"></script>
<script type="text/javascript">

    //alert(localStorage.getItem('fxpic1'));
    var slide = new auiSlide({
        container: document.getElementById("aui-slide"),
        // "width":300,
        //    "height":200,
        "speed": 300,
        "pageShow": true,
        "autoPlay": 5000,
        "pageStyle": 'dot',
        "loop": true,
        'dotPosition': 'center',
    });
    new auiLazyload({
        errorImage: '../image/error-img.jpg'
    });
    var api_url = localStorage.getItem('api_url');
    apiready = function () {




        //下拉刷新
        api.setCustomRefreshHeaderInfo({
            bgColor: '#fff',
            images: [
                'widget://image/app/xiala/1.png',
                'widget://image/app/xiala/2.png',
                'widget://image/app/xiala/3.png',
                'widget://image/app/xiala/4.png',
                'widget://image/app/xiala/5.png',
                'widget://image/app/xiala/6.png',
                'widget://image/app/xiala/7.png',
                'widget://image/app/xiala/8.png',
            ],
            tips: {
                pull: '下拉刷新！',
                threshold: '松开立即刷新！',
                load: '正在刷新'
            }

        }, function () {
            //下拉刷新被触发，自动进入加载状态，使用 api.refreshHeaderLoadDone() 手动结束加载中状态
            setTimeout(function () {
                api.refreshHeaderLoadDone()
            }, 3000);
        });
        //下拉刷新


//获取信息
        api.parseTapmode();

        getNav();
    }


    ///////广告图片 和小图标广告 点击访问 方法    imgUrl   S   ///////
    /*  function imgUrl(img){
        if (img=='img1') {
          api.openWin({
              name: 'h5',
              url: './h5.html',
              pageParam: {
                  url: localStorage.getItem('fxurl1')
              }
          });
        }else {
          api.openWin({
              name: 'h5',
              url: './h5.html',
              pageParam: {
                  url: img
              }
          });
        }

      }*/

    //// ↑ ↑ ↑ ↑ ↑原方法  ↑ ↑ ↑ ↑ ↑////
    function imgUrl(url) {


        if (url == '') {


            api.toast({
                msg: '(#^.^#) 暂无详情'
            });

        } else {


            //网络连接判断S


            api.ajax({
                url: api_url + '/login/login/banben.html',
                method: 'get',
                data: {
                    values: {
                        mike_key: localStorage.getItem('mike_key')
                    }
                }
            }, function (ret, err) {
                if (ret) {

                    //网络正常   跳转


                    /*
                    api.showProgress({
                        title: 'VIP登录中',
                        modal: false
                    });
              */
                    api.toast({
                        msg: '加载中'
                    });


                    api.openWin({
                        name: 'h5',
                        url: './h5.html',
                        pageParam: {
                            url: url
                        }
                    });


                } else {

                    //网络连接失败 进行提示
                    NetworkConnectionFailurePrompt();

                }


            });
            //网络连接判断E

        }


    }

    ///////广告图片 和小图标广告 点击访问 方法    imgUrl   E   ///////

    function h5(url) {

        if (url == '') {

        } else {
            api.openWin({
                name: 'h5',
                url: './h5.html',
                pageParam: {
                    url: url
                }
            });
        }
    }

    ///////访问轮播地址 方法    toBanner   S   ///////
    function toBanner(url) {

        if (url == '') {
            api.toast({
                msg: '(#^.^#) 暂无详情'
            });
        } else {
            //网络连接判断S
            api.ajax({
                url: api_url + '/login/login/banben.html',
                method: 'get',
                data: {
                    values: {
                        mike_key: localStorage.getItem('mike_key')
                    }
                }
            }, function (ret, err) {
                if (ret) {
                    //网络正常   跳转
                    /*
                    api.showProgress({
                        title: 'VIP登录中',
                        modal: false
                    });
              */
                    api.toast({
                        msg: '加载中'
                    });

                    api.openWin({
                        name: 'h5',
                        url: './h5.html',
                        pageParam: {
                            url: url
                        }
                    });


                } else {

                    //网络连接失败 进行提示
                    NetworkConnectionFailurePrompt();

                }


            });
//网络连接判断E

        }
    }

    ///////访问轮播地址 方法    toBanner   E   ///////


    ////////会员项目打开方法  s  ////////
    function openWin(name) {
        var time = localStorage.getItem('user_time');
        var user_id = localStorage.getItem('user_id');
        var username = localStorage.getItem('user_name');
        var timestamp = Date.parse(new Date()) / 1000;
        if (user_id != 0) {
            api.alert({
                title: '请先登录',
                msg: '知道了',
            });
            return;
        }

        if (time > timestamp) {
            api.openWin({
                name: '' + name + '',
                url: '' + name + '.html',
                bounces: false,
                delay: 300
            });
        } else if (time == -1) {
            api.openWin({
                name: '' + name + '',
                url: '' + name + '.html',
                bounces: false,
                delay: 300
            });
        } else if (time < timestamp) {
            alert('到期啦~官人先开个VIP哟');
            api.openWin({
                name: 'open_vip_win',
                url: './open_vip_win.html',
            });
        }

    }

    ////////会员项目打开方法  E  ////////


    //////////////////////    幻灯轮播图获取  方法  banNer  S  //////////////////////
    function banNer() {
        var slide = new auiSlide({
            container: document.getElementById("aui-slide"),
            // "width":300,
            "height": 150,
            "speed": 300,
            "pageShow": true,
            "autoPlay": 5000,
            "pageStyle": 'dot',
            "loop": true,
            'dotPosition': 'center',
        });
    }

    //////////////////////    幻灯轮播图获取  方法  banNer  E  //////////////////////


    //////////////////////    轮播图获取  方法  getNav  S  //////////////////////
    function getNav() {
        var flid = $api.byId('fl_list');
        var fltpl = $api.byId('flicotpl');
        var bannerid = $api.byId('slidebox');
        var bannertpl = $api.byId('bannertpl');

        var guanggaoid = $api.byId('guanggao');
        var guanggaotpl = $api.byId('guanggaotpl');

        // 添加广告
        var uid = 0;
        if (localStorage.getItem('user_id') > 1) {
            uid = localStorage.getItem('user_id');
        }
        // end
        api.ajax({
            url: api_url + '/app/nav/fl?uid=' + uid,
            method: 'get',
        }, function (ret, err) {
            if (ret) {
                //渲染模板
                var pagefn = doT.template(fltpl.text);
                flid.innerHTML = pagefn(ret.tu);
                var pagefn = doT.template(bannertpl.text);
                bannerid.innerHTML = pagefn(ret.banner);
                var pagefn = doT.template(guanggaotpl.text);
                guanggaoid.innerHTML = pagefn(ret.guanggao);
                banNer();
//        alert( JSON.stringify( ret.banner ) );


            } else {
                /*
                  alert( '网络错误' );
                  api.hideProgress();
                  */
            }
        });
    }

    //////////////////////    轮播图获取  方法  getNav  E  //////////////////////


    //////////////////////   打开APP时 获取Banner和图标  方法    DataLoading    定时     S //////////////////////

    //定时执行数据加载
    var timer = setInterval(function () {
        DataLoading();
    }, 3000)

    //判断是否服务器通信成功
    function DataLoading() {

        api.ajax({
            url: api_url + '/login/login/banben.html',
            method: 'get',
            data: {
                values: {
                    mike_key: localStorage.getItem('mike_key')
                }
            }
        }, function (ret, err) {
            if (ret) {

                getNav();    //获取Nav
                //alert( JSON.stringify( ret ) );
                /*  关闭提示
                          api.toast({
                              msg: '数据已更新',
                              duration: 1000
                          });
                */

                clearInterval(timer); // 获取成功 清除定时器
            }
            /*else {
                     api.toast({
                         msg: '数据获取成功 当前为最新数据',
                         duration: 1000
                     });

                       //alert( JSON.stringify( err ) );
                   }
                   */
        });


    }

    //////////////////////   打开APP时 获取Banner和图标  方法    DataLoading    定时     E //////////////////////


    ////////////未加载完成时点击按钮提示 方法   UnloadedCompleted   S   ////////////

    function UnloadedCompleted() {

        api.toast({
            msg: '加载失败 请检查网络是否顺畅'
        });
    }

    ////////////未加载完成时点击按钮提示 方法   UnloadedCompleted   E   ////////////


    ////////////手动开始下拉刷新的加载状态 方法  fnRefreshHeaderLoading   S   ////////////
    function fnRefreshHeaderLoading() {
        api.refreshHeaderLoading();
    };
    ////////////手动开始下拉刷新的加载状态 方法  fnRefreshHeaderLoading   E   ////////////


</script>


</html>
